package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
)

func main() {
	engine := gin.Default()

	engine.GET("/hellojson", func(context *gin.Context) {
		fullpath := context.FullPath()
		fmt.Println(fullpath)

		context.JSON(200,map[string]interface{}{
			"code": 	1,
			"masage": 	"OK",
			"data":	 	fullpath,
		})
	})

	engine.GET("/jsonstruct", func(context *gin.Context) {
		fullPath := "请求路径: " + context.FullPath()
		fmt.Println(fullPath)

		resp := Response{Code:1, Massage: "OK", Data: fullPath}
		context.JSON(200, &resp)
	})

	engine.Run(":9090")
}

type Response struct {
	Code 		int
	Massage 	string
	Data 		interface{}
}
